//
//  CommentListCell.m
//  Experss
//
//  Created by 嗯，大葱 on 17/9/19.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "CommentListCell.h"
#import "AFCircleCellCollectionImageCell.h"

@implementation CommentListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self configureV];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)configureV {
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    [self.collectionView registerNib:[UINib nibWithNibName:@"AFCircleCellCollectionImageCell" bundle:nil] forCellWithReuseIdentifier:@"AFCircleCellCollectionImageCell"];
    
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    if (_delegate && [_delegate respondsToSelector:@selector(selectImageWithCell:)]) {
        [self.delegate selectImageWithCell:self];
    }
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.imageArr.count + 1;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    AFCircleCellCollectionImageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"AFCircleCellCollectionImageCell" forIndexPath:indexPath];
    if (indexPath.row == self.imageArr.count) {
        cell.image.image = [UIImage imageNamed:@"shenqingtuihuo_tianjiatupian"];
    }else {
        cell.image.image = self.imageArr[indexPath.row];
    }
    return cell;
}

- (NSMutableArray *)imageArr {
    if (!_imageArr) {
        self.imageArr = [NSMutableArray array];
    }
    return _imageArr;
}

@end
